import axios from '@/utils/request'
const base = '/movieserver'

export function listMovieRoles(id, version) {
  return axios({
    url: `${base}/playRoleInstances/movie/${id}/v/${version}`,
    method: 'get'
  })
}

export function downloadMovieRoleFile(movieId, movieVersion, roleId) {
  return axios.get(`${base}/playRoleInstances/movie/${movieId}/v/${movieVersion}/playRole/${roleId}/file`, { responseType: 'arraybuffer', timeout: 3600000 })
}

/**
 * 批量下载多个角色文件
 * @param reqs 下载角色文件请求数组
 * @returns {Promise<unknown[]>}
 */
export function downloadMultiMovieRoleFile(reqs) {
  return axios.all(reqs)
}
